home *** CD-ROM | disk | FTP | other *** search
/ JCSM Shareware Collection 1996 September / JCSM Shareware Collection (JCS Distribution) (September 1996).ISO / prgtools / czlis110.zip / DEMOFILE.FRM < prev    next >
Text File  |  1994-10-29  |  16KB  |  652 lines

  1. Version 1.00
  2. BEGIN Form frmDemofile
  3.     AutoRedraw   = 0
  4.     BackColor    = QBColor(7)
  5.     BorderStyle  = 2
  6.     Caption      = "CzFile"
  7.     ControlBox   = -1
  8.     Enabled      = -1
  9.     ForeColor    = QBColor(0)
  10.     Height       = Char(23)
  11.     Left         = Char(2)
  12.     MaxButton    = -1
  13.     MinButton    = -1
  14.     MousePointer = 0
  15.     Tag          = ""
  16.     Top          = Char(1)
  17.     Visible      = -1
  18.     Width        = Char(74)
  19.     WindowState  = 0
  20.     BEGIN Frame Frame1
  21.         BackColor    = QBColor(7)
  22.         Caption      = "General Information:"
  23.         DragMode     = 0
  24.         Enabled      = -1
  25.         ForeColor    = QBColor(0)
  26.         Height       = Char(6)
  27.         Left         = Char(2)
  28.         MousePointer = 0
  29.         TabIndex     = 12
  30.         Tag          = ""
  31.         Top          = Char(15)
  32.         Visible      = -1
  33.         Width        = Char(57)
  34.         BEGIN Label Label7
  35.             Alignment    = 0
  36.             AutoSize     = 0
  37.             BackColor    = QBColor(7)
  38.             BorderStyle  = 0
  39.             Caption      = "Label7"
  40.             DragMode     = 0
  41.             Enabled      = -1
  42.             ForeColor    = QBColor(0)
  43.             Height       = Char(1)
  44.             Left         = Char(1)
  45.             MousePointer = 0
  46.             TabIndex     = 18
  47.             Tag          = ""
  48.             Top          = Char(3)
  49.             Visible      = -1
  50.             Width        = Char(49)
  51.         END
  52.         BEGIN Label Label3
  53.             Alignment    = 0
  54.             AutoSize     = 0
  55.             BackColor    = QBColor(7)
  56.             BorderStyle  = 0
  57.             Caption      = "Label3"
  58.             DragMode     = 0
  59.             Enabled      = -1
  60.             ForeColor    = QBColor(0)
  61.             Height       = Char(1)
  62.             Left         = Char(1)
  63.             MousePointer = 0
  64.             TabIndex     = 17
  65.             Tag          = ""
  66.             Top          = Char(2)
  67.             Visible      = -1
  68.             Width        = Char(49)
  69.         END
  70.         BEGIN Label Label2
  71.             Alignment    = 0
  72.             AutoSize     = 0
  73.             BackColor    = QBColor(7)
  74.             BorderStyle  = 0
  75.             Caption      = "Label2"
  76.             DragMode     = 0
  77.             Enabled      = -1
  78.             ForeColor    = QBColor(0)
  79.             Height       = Char(1)
  80.             Left         = Char(1)
  81.             MousePointer = 0
  82.             TabIndex     = 16
  83.             Tag          = ""
  84.             Top          = Char(1)
  85.             Visible      = -1
  86.             Width        = Char(30)
  87.         END
  88.         BEGIN Label Label4
  89.             Alignment    = 0
  90.             AutoSize     = 0
  91.             BackColor    = QBColor(7)
  92.             BorderStyle  = 0
  93.             Caption      = "(Press ENTER to display!)"
  94.             DragMode     = 0
  95.             Enabled      = -1
  96.             ForeColor    = QBColor(15)
  97.             Height       = Char(1)
  98.             Left         = Char(19)
  99.             MousePointer = 0
  100.             TabIndex     = 15
  101.             Tag          = ""
  102.             Top          = Char(0)
  103.             Visible      = -1
  104.             Width        = Char(25)
  105.         END
  106.         BEGIN Label lblListIndex
  107.             Alignment    = 0
  108.             AutoSize     = 0
  109.             BackColor    = QBColor(7)
  110.             BorderStyle  = 0
  111.             Caption      = "Label1"
  112.             DragMode     = 0
  113.             Enabled      = -1
  114.             ForeColor    = QBColor(0)
  115.             Height       = Char(1)
  116.             Left         = Char(12)
  117.             MousePointer = 0
  118.             TabIndex     = 14
  119.             Tag          = ""
  120.             Top          = Char(0)
  121.             Visible      = -1
  122.             Width        = Char(7)
  123.         END
  124.         BEGIN Label Label5
  125.             Alignment    = 0
  126.             AutoSize     = 0
  127.             BackColor    = QBColor(7)
  128.             BorderStyle  = 0
  129.             Caption      = "ListIndex ="
  130.             DragMode     = 0
  131.             Enabled      = -1
  132.             ForeColor    = QBColor(0)
  133.             Height       = Char(1)
  134.             Index        = 1
  135.             Left         = Char(1)
  136.             MousePointer = 0
  137.             TabIndex     = 13
  138.             Tag          = ""
  139.             Top          = Char(0)
  140.             Visible      = -1
  141.             Width        = Char(11)
  142.         END
  143.     END
  144.     BEGIN Frame Frame2
  145.         BackColor    = QBColor(7)
  146.         Caption      = "Tagging:"
  147.         DragMode     = 0
  148.         Enabled      = -1
  149.         ForeColor    = QBColor(0)
  150.         Height       = Char(6)
  151.         Left         = Char(2)
  152.         MousePointer = 0
  153.         TabIndex     = 2
  154.         Tag          = ""
  155.         Top          = Char(9)
  156.         Visible      = -1
  157.         Width        = Char(68)
  158.         BEGIN Label Label5
  159.             Alignment    = 0
  160.             AutoSize     = 0
  161.             BackColor    = QBColor(7)
  162.             BorderStyle  = 0
  163.             Caption      = "Items Tagged ="
  164.             DragMode     = 0
  165.             Enabled      = -1
  166.             ForeColor    = QBColor(0)
  167.             Height       = Char(1)
  168.             Index        = 0
  169.             Left         = Char(33)
  170.             MousePointer = 0
  171.             TabIndex     = 6
  172.             Tag          = ""
  173.             Top          = Char(0)
  174.             Visible      = -1
  175.             Width        = Char(14)
  176.         END
  177.         BEGIN Label Label9
  178.             Alignment    = 0
  179.             AutoSize     = 0
  180.             BackColor    = QBColor(7)
  181.             BorderStyle  = 0
  182.             Caption      = "Mouse: RIGHT button to tag/untag"
  183.             DragMode     = 0
  184.             Enabled      = -1
  185.             ForeColor    = QBColor(15)
  186.             Height       = Char(1)
  187.             Left         = Char(33)
  188.             MousePointer = 0
  189.             TabIndex     = 11
  190.             Tag          = ""
  191.             Top          = Char(3)
  192.             Visible      = -1
  193.             Width        = Char(32)
  194.         END
  195.         BEGIN Label Label8
  196.             Alignment    = 0
  197.             AutoSize     = 0
  198.             BackColor    = QBColor(7)
  199.             BorderStyle  = 0
  200.             Caption      = "Keyboard: SPACE to tag/untag"
  201.             DragMode     = 0
  202.             Enabled      = -1
  203.             ForeColor    = QBColor(15)
  204.             Height       = Char(1)
  205.             Left         = Char(1)
  206.             MousePointer = 0
  207.             TabIndex     = 10
  208.             Tag          = ""
  209.             Top          = Char(3)
  210.             Visible      = -1
  211.             Width        = Char(30)
  212.         END
  213.         BEGIN CommandButton cmdUntag
  214.             BackColor    = QBColor(7)
  215.             Cancel       = 0
  216.             Caption      = "&Untag All Items"
  217.             Default      = 0
  218.             DragMode     = 0
  219.             Enabled      = -1
  220.             Height       = Char(1)
  221.             Left         = Char(33)
  222.             MousePointer = 0
  223.             TabIndex     = 9
  224.             TabStop      = -1
  225.             Tag          = ""
  226.             Top          = Char(2)
  227.             Visible      = -1
  228.             Width        = Char(19)
  229.         END
  230.         BEGIN CommandButton cmdTag
  231.             BackColor    = QBColor(7)
  232.             Cancel       = 0
  233.             Caption      = "&Tag All Items"
  234.             Default      = 0
  235.             DragMode     = 0
  236.             Enabled      = -1
  237.             Height       = Char(1)
  238.             Left         = Char(33)
  239.             MousePointer = 0
  240.             TabIndex     = 8
  241.             TabStop      = -1
  242.             Tag          = ""
  243.             Top          = Char(1)
  244.             Visible      = -1
  245.             Width        = Char(19)
  246.         END
  247.         BEGIN Label lblItemsTagged
  248.             Alignment    = 0
  249.             AutoSize     = 0
  250.             BackColor    = QBColor(7)
  251.             BorderStyle  = 0
  252.             Caption      = "Label6"
  253.             DragMode     = 0
  254.             Enabled      = -1
  255.             ForeColor    = QBColor(0)
  256.             Height       = Char(1)
  257.             Left         = Char(47)
  258.             MousePointer = 0
  259.             TabIndex     = 7
  260.             Tag          = ""
  261.             Top          = Char(0)
  262.             Visible      = -1
  263.             Width        = Char(7)
  264.         END
  265.         BEGIN CheckBox chkMouseTag
  266.             BackColor    = QBColor(7)
  267.             Caption      = "&Mouse Tag-Scrolling"
  268.             DragMode     = 0
  269.             Enabled      = -1
  270.             ForeColor    = QBColor(0)
  271.             Height       = Char(1)
  272.             Left         = Char(1)
  273.             MousePointer = 0
  274.             TabIndex     = 5
  275.             TabStop      = -1
  276.             Tag          = ""
  277.             Top          = Char(2)
  278.             Value        = 0
  279.             Visible      = -1
  280.             Width        = Char(26)
  281.         END
  282.         BEGIN CheckBox chkKeybTag
  283.             BackColor    = QBColor(7)
  284.             Caption      = "&Keyboard Tag-Scrolling"
  285.             DragMode     = 0
  286.             Enabled      = -1
  287.             ForeColor    = QBColor(0)
  288.             Height       = Char(1)
  289.             Left         = Char(1)
  290.             MousePointer = 0
  291.             TabIndex     = 4
  292.             TabStop      = -1
  293.             Tag          = ""
  294.             Top          = Char(1)
  295.             Value        = 0
  296.             Visible      = -1
  297.             Width        = Char(26)
  298.         END
  299.         BEGIN CheckBox chkAllowTag
  300.             BackColor    = QBColor(7)
  301.             Caption      = "&Allow Tagging"
  302.             DragMode     = 0
  303.             Enabled      = -1
  304.             ForeColor    = QBColor(0)
  305.             Height       = Char(1)
  306.             Left         = Char(1)
  307.             MousePointer = 0
  308.             TabIndex     = 3
  309.             TabStop      = -1
  310.             Tag          = ""
  311.             Top          = Char(0)
  312.             Value        = 0
  313.             Visible      = -1
  314.             Width        = Char(22)
  315.         END
  316.     END
  317.     BEGIN Label Label10
  318.         Alignment    = 0
  319.         AutoSize     = 0
  320.         BackColor    = QBColor(7)
  321.         BorderStyle  = 0
  322.         Caption      = "With the mouse: Click on the top or bottom box line to scroll as well."
  323.         DragMode     = 0
  324.         Enabled      = -1
  325.         ForeColor    = QBColor(15)
  326.         Height       = Char(1)
  327.         Left         = Char(1)
  328.         MousePointer = 0
  329.         TabIndex     = 0
  330.         Tag          = ""
  331.         Top          = Char(1)
  332.         Visible      = -1
  333.         Width        = Char(70)
  334.     END
  335.     BEGIN CommandButton cmdALl
  336.         BackColor    = QBColor(7)
  337.         Cancel       = -1
  338.         Caption      = "A&ll"
  339.         Default      = 0
  340.         DragMode     = 0
  341.         Enabled      = -1
  342.         Height       = Char(3)
  343.         Left         = Char(60)
  344.         MousePointer = 0
  345.         TabIndex     = 20
  346.         TabStop      = -1
  347.         Tag          = ""
  348.         Top          = Char(15)
  349.         Visible      = -1
  350.         Width        = Char(10)
  351.     END
  352.     BEGIN CommandButton cmdCancel
  353.         BackColor    = QBColor(7)
  354.         Cancel       = 0
  355.         Caption      = "&Cancel"
  356.         Default      = 0
  357.         DragMode     = 0
  358.         Enabled      = -1
  359.         Height       = Char(3)
  360.         Left         = Char(60)
  361.         MousePointer = 0
  362.         TabIndex     = 19
  363.         TabStop      = -1
  364.         Tag          = ""
  365.         Top          = Char(18)
  366.         Visible      = -1
  367.         Width        = Char(10)
  368.     END
  369.     BEGIN Custom CzFile
  370.         Action       = 0
  371.         Alignment    = 0
  372.         Archive      = 0
  373.         AutoRedraw   = 0
  374.         BackColor    = QBColor(7)
  375.         BorderStyle  = 1
  376.         Caption      = ""
  377.         Checked      = 0
  378.         Column       = 0
  379.         DragMode     = 0
  380.         Drive        = ""
  381.         Enabled      = -1
  382.         Filename     = ""
  383.         ForeColor    = QBColor(0)
  384.         Height       = Char(7)
  385.         Hidden       = 0
  386.         Interval     = 0
  387.         LargeChange  = 0
  388.         Left         = Char(2)
  389.         ListCount    = 0
  390.         ListIndex    = 0
  391.         Max          = 0
  392.         Min          = 0
  393.         Mode         = 0
  394.         MousePointer = 0
  395.         MultiLine    = 0
  396.         Normal       = 0
  397.         Path         = ""
  398.         Pattern      = ""
  399.         ReadOnly     = -1
  400.         Row          = 0
  401.         ScrollBars   = 0
  402.         SelLength    = 0
  403.         SelStart     = 0
  404.         SelText      = ""
  405.         SmallChange  = 0
  406.         Sorted       = 0
  407.         Style        = 0
  408.         System       = 0
  409.         TabIndex     = 1
  410.         TabStop      = -1
  411.         Tag          = ""
  412.         Text         = ""
  413.         Top          = Char(2)
  414.         TypeID       = "CzFile"
  415.         Value        = 0
  416.         Visible      = -1
  417.         Width        = Char(53)
  418.     END
  419. END
  420. DEFINT A-Z
  421.  
  422. '$FORM frmGeneral
  423. '$FORM frmDemoAll
  424. '$FORM frmOrder
  425.  
  426. ' CzList Internal functions. These functions have to be declared if you
  427. ' want to use them.
  428. DECLARE FUNCTION CzGetWhatKindMem% ()
  429. DECLARE FUNCTION CzItemsTagged% ()
  430. DECLARE FUNCTION CzAllowTagging% (YesNo%)
  431. DECLARE FUNCTION CzKeybTagScrolling% (YesNo%)
  432. DECLARE FUNCTION CzMouTagScrolling% (YesNo%)
  433. DECLARE FUNCTION CzSetVirtualPath% (PathToSet$)
  434.  
  435. ' Demo functions
  436. DECLARE SUB AboutCzFile ()
  437.  
  438. SUB AboutCzFile ()
  439.  
  440.    a$ = "CzFile is a file listbox control for VBDOS. It displays file name, size, date, time, and attributes. It fully supports tagging and untagging."
  441. a$ = a$ + CHR$(13) + CHR$(10)
  442. a$ = a$ + CHR$(13) + CHR$(10) + "You can tell CzFile to alphabetically sort the files or not. Sorting the files will increase the time to read all files into the listbox."
  443. a$ = a$ + CHR$(13) + CHR$(10)
  444. a$ = a$ + CHR$(13) + CHR$(10) + "CzFile will first try to use XMS Memory. If no XMS memory is available, it will try to use EMS Memory. If no XMS and no EMS memory is available, CzFile will use the disk as virtual memory."
  445. MSGBOX a$, 0, "CzFile Demo"
  446.  
  447. END SUB
  448.  
  449. SUB chkAllowTag_Click ()
  450.  
  451. IF chkAllowTag.Value = 1 THEN
  452.    Result = CzAllowTagging(0)
  453.    Result = CzKeybTagScrolling(0)
  454.    Result = CzMouTagScrolling(0)
  455.    chkKeybTag.Enabled = -1
  456.    chkMouseTag.Enabled = -1
  457.    chkKeybTag.Value = 1
  458.    chkMouseTag.Value = 1
  459. ELSE
  460.    Result = CzAllowTagging(1)
  461.    Result = CzKeybTagScrolling(1)
  462.    Result = CzMouTagScrolling(1)
  463.    chkKeybTag.Enabled = 0
  464.    chkMouseTag.Enabled = 0
  465. END IF
  466.  
  467. END SUB
  468.  
  469. SUB chkKeybTag_Click ()
  470.  
  471. IF chkKeybTag.Value = 1 THEN
  472.    Result = CzKeybTagScrolling(0)
  473. ELSE
  474.    Result = CzKeybTagScrolling(1)
  475. END IF
  476.  
  477. END SUB
  478.  
  479. SUB chkMouseTag_Click ()
  480.  
  481. IF chkMouseTag.Value = 1 THEN
  482.    Result = CzMouTagScrolling(0)
  483. ELSE
  484.    Result = CzMouTagScrolling(1)
  485. END IF
  486.  
  487. END SUB
  488.  
  489. SUB cmdALl_Click ()
  490.  
  491. ' You must UNLOAD the form or control(s) before you end your program. CzFile
  492. ' will then remove itself from memory. If you do not unload the form or
  493. ' control, the memory used by CzFile (either XMS, EMS, or disk space) will
  494. ' not be released and unpredictable results may occur.
  495. UNLOAD frmDemoFile
  496. frmDemoAll.SHOW 1
  497.  
  498. END SUB
  499.  
  500. SUB cmdCancel_Click ()
  501.  
  502. ' You must UNLOAD the form or control(s) before you end your program. CzFile
  503. ' will then remove itself from memory. If you do not unload the form or
  504. ' control, the memory used by CzFile (either XMS, EMS, or disk space) will
  505. ' not be released and unpredictable results may occur.
  506. UNLOAD frmDemoFile
  507. frmOrder.SHOW 1
  508. END
  509.  
  510. END SUB
  511.  
  512. SUB cmdTag_Click ()
  513.  
  514. ' Tag all elements
  515. ' Value = 1     : tag alll elements in CzFile
  516. ' Value = 2     : untag alll elements in CzFile
  517. CzFile.Value = 1
  518.  
  519. ' Display the number of items tagged.
  520. lblItemsTagged.Caption = STR$(CzItemsTagged)
  521.  
  522. CzFile.SETFOCUS
  523.  
  524. END SUB
  525.  
  526. SUB cmdUntag_Click ()
  527.  
  528. ' Untag all elements
  529. ' Value = 1     : tag alll elements in CzFile
  530. ' Value = 2     : untag alll elements in CzFile
  531. CzFile.Value = 2
  532.  
  533. ' Display the number of items tagged.
  534. lblItemsTagged.Caption = STR$(CzItemsTagged)
  535.  
  536. CzFile.SETFOCUS
  537.  
  538. END SUB
  539.  
  540. SUB CzFile_DblClick ()
  541.  
  542. ' Get the current element and display it.
  543. ' CzFile.ListIndex is the current Index. You can also get any other
  544. ' index from 0 to ListCount. For example, to get element 189, use
  545. ' Dummy$ = CzFile.List(188). Remember, the list starts with element 0.
  546. MSGBOX CzFile.List(CzFile.ListIndex), 0, "Mouse Double Click"
  547.  
  548. END SUB
  549.  
  550. SUB CzFile_KeyDown (KeyCode AS INTEGER, Shift AS INTEGER)
  551.  
  552. ' Display the current index.
  553. lblListIndex.Caption = STR$(CzFile.ListIndex)
  554.  
  555. ' Display the number of items tagged.
  556. lblItemsTagged.Caption = STR$(CzItemsTagged)
  557.  
  558. ' The ENTER key was pressed. Get the current element and display it.
  559. ' CzFile.ListIndex is the current Index. You can also get any other
  560. ' index from 0 to ListCount. For example, to get element 189, use
  561. ' Dummy$ = CzFile.List(188). Remember, the list starts with element 0.
  562. IF KeyCode = 13 THEN MSGBOX CzFile.List(CzFile.ListIndex), 0, "Pressed Enter Key"
  563.  
  564. END SUB
  565.  
  566. SUB CzFile_MouseDown (Button AS INTEGER, Shift AS INTEGER, X AS SINGLE, Y AS SINGLE)
  567.  
  568. ' Display the number of items tagged.
  569. lblItemsTagged.Caption = STR$(CzItemsTagged)
  570.  
  571. END SUB
  572.  
  573. SUB CzFile_MouseUp (Button AS INTEGER, Shift AS INTEGER, X AS SINGLE, Y AS SINGLE)
  574.  
  575. ' Display the current index.
  576. lblListIndex.Caption = STR$(CzFile.ListIndex)
  577.  
  578. END SUB
  579.  
  580. SUB Form_Load ()
  581.  
  582. Left = ((SCREEN.Width - Width) / 2)   ' Center form horizontally
  583. Top = ((SCREEN.Height - Height) / 2)  ' Center form vertically
  584.  
  585. AboutCzFile
  586.  
  587. CzFile.Max = 1999
  588. NumElements& = CzFile.Max
  589. CzFile.Sorted = -1
  590.  
  591. ' Get a path from user
  592. PathToRead$ = INPUTBOX$("Enter a path including wildcards to read. *.* will read the current path. For example, C:\CZLIST\*.*", "", "*.*")
  593.  
  594. ' Display status window
  595. frmGeneral.Label1.Caption = "One moment...reading file information."
  596. frmGeneral.SHOW
  597.  
  598. ' Start reading the drive
  599. CzFile.Path = PathToRead$
  600.  
  601. ' Unload status window from memory
  602. UNLOAD frmGeneral
  603.  
  604. lblListIndex.Caption = STR$(CzList.ListIndex) ' Display the current index.
  605.  
  606. lblItemsTagged.Caption = STR$(CzItemsTagged)  ' Display the number of items
  607.                      ' tagged.
  608.  
  609. ' Display the number of elements used.
  610. Label2.Caption = "Number of elements =" + STR$(NumElements& + 1)
  611.  
  612. MemoryUsed& = (NumElements& + 1) * 76
  613. SELECT CASE CzGetWhatKindMem
  614.    CASE -1   ' Use XMS
  615.       d$ = "XMS Memory"
  616.    CASE -2   ' Use EMS
  617.       d$ = "EMS Memory"
  618.       ' EMS requires additional 16 KBytes for memory page slackspace
  619.       MemoryUsed& = ((NumElements& + 1) * 76) + 16384
  620.    CASE ELSE
  621.       d$ = "Disk"
  622. END SELECT
  623.  
  624. ' Show the amount of memory or disk space used.
  625. Label3.Caption = "Used =" + STR$(MemoryUsed&) + " Bytes (" + d$ + ")"
  626.  
  627. ' Show the amount of conventional memory used.
  628. Label7.Caption = "Conventional Memory Free =" + STR$(FRE(-1)) + " Bytes"
  629.  
  630. ' ***** Setup Scrolling and Tagging *****
  631. ' Result = The current status, which is either 0 or 1
  632. ' Result = CzAllowTagging(0)       ' 1 = Disable, 0 = Enable
  633. ' Result = CzKeybTagScrolling(0)   ' 1 = Disable, 0 = Enable
  634. ' Result = CzMouTagScrolling(0)    ' 1 = Disable, 0 = Enable
  635.  
  636. IF CzAllowTagging(0) = 0 THEN
  637.    chkAllowTag.Value = 1
  638.    IF CzKeybTagScrolling(0) = 0 THEN
  639.       chkKeybTag.Value = 1
  640.    ELSE
  641.       chkKeybTag.Value = 2
  642.    END IF
  643.    IF CzMouTagScrolling(0) = 0 THEN
  644.       chkMouseTag.Value = 1
  645.    ELSE
  646.       chkMouseTag.Value = 2
  647.    END IF
  648. END IF
  649.  
  650. END SUB
  651.  
  652.